<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=div.box1, initial-scale=1.0">
    <title>Document</title>
    <style>
        .outer{
            border: 10px red solid;
        }
        .box1{
            width: 200px;
            height: 200px;
            background-color: blueviolet;
            float: left;
        }
        .box2{
            width: 200px;
            height: 200px;
            background-color: rgb(166, 112, 216);
            /* float: left; */
            /* 开启bfc */
            overflow: auto;
        }
    </style>
</head>
<body>
    <div class="outer">   
        <div class="box1">

        </div>
        <div class="box2">

        </div>     
    </div>
</body>
</html>